<div class="blog-content">
    <div class="post">
        <div class="post-title">
            <h5>{$post.title}</h5>
            <span class="time">{date('d.m.Y H:i', $post.time)} by Aleksiev</span>
        </div>
        <div class="post-content">
            {$post.content}
        </div>
        <div class="post-meta">
            <span class="categories">
                Category <a href="">{$categories[$post.category].name}</a> 
                Tags:
                {foreach $post.tags as $k => $t}
                <a href="blog.php?tag={$t}">{$t}</a>{if $k+1 < count($post.tags)},{/if}
                {/foreach}
            </span>
            <span class="post-comments"><a href="#comment_form">Write a comment</a></span>
{*            <span class="sources">Sources: <a href="" target="_blank"></a></span>*}
        </div>
    </div>

    <div class="comments">
        <h4>Comments ({count($comments)})</h4>
        
        {if $comments}
        {foreach $comments as $c}
        <div class="comment" id="{$c.id}">
            <div class="comment-title">
                <span class="author">{if $c.author_website}<a href="{$c.author_website}" target="_blank">{/if}{$c.author_name}{if $c.author_website}</a>{/if}</span> said:
                <span class="time">{date('d.m.Y H:i', $c.time)}</span>
            </div>
            <div class="comment-content">
                <p>{$c.content}</p>
            </div>
            <div class="comment-options {if $c.replys}comment-reply{/if}">
                <a class="reply">Reply</a>
                <a href="" class="report">Report</a>
            </div>
            {if $c.replys}
            {foreach $c.replys as $k => $reply}
            <div class="reply {if $k + 1 == count($c.replys)}last{/if}">
                <div class="comment-title">
                    <span class="author">{if $reply.author_website}<a href="{$reply.author_website}" target="_blank">{/if}{$reply.author_name}{if $reply.author_website}</a>{/if}</span> said:
                    <span class="time">{date('d.m.Y H:i', $reply.time)}</span>
                </div>
                <div class="comment-content">
                    <p>{$reply.content}</p>
                </div>
                <div class="comment-options">
                    <a href="" class="report">Report</a>
                </div>
            </div>
            {/foreach}
            {/if}
        </div>
        {/foreach}
        {/if}
    </div>
    
    <div class="comment-form" id="comment_form">
        <h4>Leave a Comment</h4>
        
        <form action="post.php" method="POST">
            <input type="text" name="name" placeholder="Name *" required>
            <input type="text" name="email" placeholder="E-mail *" required>
            <input class="last" type="text" name="website" placeholder="Website">
            <textarea name="comment" placeholder="Comment *" required></textarea>
            <span>Fields with * are reequired.</span>
            <input type="hidden" name="leave_comment" value="1">
            <input type="hidden" name="post_id" value="{$post.id}">
            <button>Submit</button>
        </form>
    </div>
</div>